<%@ Page Language="VB" StylesheetTheme="default" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="InstrumentManager.aspx.vb" Inherits="Modules_Questionnaires_InstrumentManager" title="Instrument Manager Page" %>
<%@ Register Assembly="DotNetPM.Web.UI.WebControls" TagPrefix="cc" Namespace="DotNetPM.Web.UI.WebControls" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div>
        <table id="Table1" border="0" cellpadding="2" cellspacing="2" width="100%">
            <tr>
                <td colspan="4" height="1">
                    <table width=100% cellpadding="0" cellspacing="0">
                        <tr>
                            <td>
                                <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/iman.gif" ImageAlign="AbsMiddle" />
                                <strong><font size="3">INSTRUMENT MANAGER</font></strong></td>
                            <td align=right>
                                <cc:DynImageButton ID="iButQuestion" runat="server" ImageAlign="AbsMiddle" ImageUrl="~/Images/qman_0.gif"
                                    ToolTip="Question Manager" />
                                <cc:DynImageButton ID="iButQuestionnaire" runat="server" ImageAlign="AbsMiddle" ImageUrl="~/Images/qnman_0.gif"
                                    ToolTip="Questionnaire Manager" /></td>
                        </tr>
                    </table></td>
                <td align="right" colspan="1">
                    <asp:HyperLink ID="hlBack" runat="server" NavigateUrl="Default.aspx" ForeColor="Blue">Back</asp:HyperLink></td>
            </tr>
            <tr style="color: #000000">
                <td colspan="5">
                    <hr size="1" width="100%" />
                </td>
            </tr>
            <tr>
                <td rowspan="2" valign="top" width="15">
                    &nbsp;</td>
                    <td valign="top">
                    <table border=0 cellpadding="4" >
                        <tr>
                            <td align="right"> Filter by Field : </td>
                            <td >
                                <asp:DropDownList ID="ddlFieldToSearch" runat="server" AppendDataBoundItems="True">
                                    <asp:ListItem>Name</asp:ListItem>
                                    <asp:ListItem>Description</asp:ListItem>
                                    <asp:ListItem>Instrument ID</asp:ListItem>
                                    <asp:ListItem>Instruction</asp:ListItem>
                                </asp:DropDownList> contains <asp:TextBox ID="txtStringToSearch" runat="server" MaxLength="50"></asp:TextBox></td>
                            <td>
                                <asp:Button ID="butSearch" runat="server" Text="Search" Width="60px" />&nbsp;
                                <asp:Button ID="butClear" runat="server" Text="Clear" Width="60px" /></td>
                        </tr>
                    </table></td>
                <td align="right" valign="bottom">
                    <asp:LinkButton ID="lbutNew" runat="server" Font-Bold="True"><SPAN style="POSITION: relative; TOP: -4px; left:-4px">Add A New Instrument</SPAN><img src="../../Images/New.gif" style="border-width:0px;POSITION: relative;" /></asp:LinkButton></td>
                <td colspan="2" valign="top" width="300" />
            </tr>
        <tr>
            <td colspan="2" height="300" valign="top">
                <asp:GridView ID="gvInstruments" runat="server" AllowPaging="True" AutoGenerateColumns="False" AllowSorting="True" Width="820px" DataSourceID="InstumentsODS">
                    <Columns>
                        <asp:TemplateField HeaderText="Instrument ID" SortExpression="InstrumentID">
                            <ItemStyle Width="120px" />
                            <ItemTemplate>
                                <asp:Label ID="lblInstrumentId" runat="server" Text='<%# Bind("InstrumentID") %>'></asp:Label>
                            </ItemTemplate>
                            <FooterTemplate>
                                <asp:TextBox ID="txtInstrumentId" runat="server" Text='<%# Bind("InstrumentID") %>' />
                                <asp:RequiredFieldValidator ID="reqInstrumentId" runat="server" ControlToValidate="txtInstrumentId" ValidationGroup="Adding"
                                    Display="Dynamic" ErrorMessage="InstrumentID is required." Text="* InstrumentID is required."></asp:RequiredFieldValidator>
                            </FooterTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Name" SortExpression="Name">
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
                            </ItemTemplate>
                            <FooterTemplate>
                                <cc:counttextbox id="ctbName" runat="server"  maxlength="250" rows="2" text='<%# Bind("Name") %>' textmode="MultiLine" width="480px" />
                                <asp:RequiredFieldValidator ID="reqName" runat="server" ControlToValidate="ctbName" ValidationGroup="Adding"
                                    Display="Dynamic" ErrorMessage="Name is required." Text="* Name is required."></asp:RequiredFieldValidator>
                            </FooterTemplate>
                            <ItemStyle Width="420px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Last Updated" SortExpression="utcLastUpdated">
                            <ItemStyle Width="140px" />
                            <ItemTemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# Eval("utcLastUpdated").ToLocalTime %>'></asp:Label>
                            </ItemTemplate>
                            <FooterTemplate>
                                    <asp:ImageButton ID="butInsert" runat="server" CausesValidation=true OnClick="butInsert_Click" 
                                          ValidationGroup="Adding" AlternateText="Insert" ImageUrl="~/images/ok.gif" />
                                    <asp:ImageButton ID="butCancel" runat="server" CausesValidation=false OnClick="butCancel_Click" 
                                          ValidationGroup="Adding" AlternateText="Cancel" ImageUrl="~/images/cancel.gif" />
                            </FooterTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField ShowHeader="False">
                            <ItemStyle Width="36px"/>
                            <ItemTemplate>
                                <cc:DynImageButton ID="ibDetail" runat="server" CausesValidation="true" CommandName="ShowDetail" 
                                     CommandArgument='<%# Container.DataItemIndex %>' AlternateText="Detail" ImageUrl="~/Images/Detail_0.gif" ToolTip="Instrument Detail"/>
                                <cc:DynImageButton ID="ibLocked" runat="server" CausesValidation="true" CommandName="LockInstrument" Visible=<%# Not Eval("Locked") %> OnClientClick ='event.returnValue=confirm("WARNING!!! By locking, this instrument will no longer editable.\r\nAre you sure to process the locking procedure ?");'
                                     CommandArgument='<%# Container.DataItemIndex %>' AlternateText="Locked" ImageUrl="~/Images/Locked_0.gif" ToolTip="Lock This Instrument"/>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle VerticalAlign="Top" />
                    <EmptyDataTemplate>
                        <table border="0" cellpadding="2" cellspacing="2"
                                style="BORDER-TOP-WIDTH:1px;BORDER-LEFT-WIDTH:1px;BORDER-LEFT-COLOR:black;LEFT:0px;BORDER-BOTTOM-WIDTH:1px;
                                BORDER-BOTTOM-COLOR:black;MARGIN:-4px;WIDTH:820px;BORDER-TOP-COLOR: black;TOP:0px;BACKGROUND-COLOR:white;
                                BORDER-RIGHT-WIDTH:1px;BORDER-RIGHT-COLOR: black">
                            <tr style="font-weight: bold; color:mistyrose; background-color:#4a3c8c">
                                <th style="width:160px;">Instrument ID</th>
                                <th style="width:500px;">Name</th>
                                <th style="width:120px;">Last Updated</th>
                                <th style="width:40px;">&nbsp;</th>
                            </tr>
                            <tr id="trEmptyMessage" runat="server" visible="true" style="color:Black;background-color:#EEEEEE;">
			                    <td colspan="4" align="center" >
			                        <br /><strong>There is no instrument in the database.</strong><br /><br />
			                    </td>
		                    </tr>
                            <tr valign="top" id="trEmpty" runat="server" visible="false" style="color:Black;background-color:#EEEEEE;">
                                <td>
                                    <asp:TextBox ID="txtInstrumentId" runat="server" Width="140px" Text='<%# Bind("InstrumentID") %>' />
                                    <asp:RequiredFieldValidator ID="reqInstrumentId" runat="server" ControlToValidate="txtInstrumentId" ValidationGroup="Adding"
                                        ErrorMessage="InstrumentID is required." Text="*" />
                                </td>
                                <td>
                                    <table cellpadding="0" cellspacing="0" border="0" width="480px">
                                        <tr>
                                            <td><cc:counttextbox id="ctbName" runat="server"  maxlength="250" rows="2" text='<%# Bind("Name") %>' textmode="MultiLine" width="480px" /></td>
                                            <td><asp:RequiredFieldValidator ID="reqName" runat="server" ControlToValidate="ctbName" ValidationGroup="Adding"
                                                    ErrorMessage="Name is required." Text="&nbsp;*" /></td>
                                        </tr>
                                    </table>                               
                                </td>
                                <td>
                                    <asp:ImageButton ID="butInsert" runat="server" CausesValidation=true OnClick="butInsert_Click" 
                                          ValidationGroup="Adding" AlternateText="Insert" ImageUrl="~/images/ok.gif" />
                                    <asp:ImageButton ID="butCancel" runat="server" CausesValidation=false OnClick="butCancel_Click"
                                          ValidationGroup="Adding" AlternateText="Cancel" ImageUrl="~/images/cancel.gif" />
                                </td>
                                <td>&nbsp;</td>
                            </tr>
                     </table>
                    </EmptyDataTemplate>
                </asp:GridView>
                <asp:ObjectDataSource ID="InstumentsODS" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetInstruments" TypeName="DotNetPM.Business.Questionnaire.InstrumentODS">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddlFieldToSearch" Name="FieldToSearch" PropertyName="SelectedValue"
                            Type="String" />
                        <asp:ControlParameter ControlID="txtStringToSearch" Name="StringToSearch" PropertyName="Text"
                            Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetTemplateEditingVerbs"
                    TypeName="eWorld.UI.Design.FaqRepeaterDesigner"></asp:ObjectDataSource>
            </td>
            <td colspan="2"  valign="top">
            </td>
        </tr>
        </table>
    
    </div>
</asp:Content>

